package cn.mazexal.examapi.models.enums;

import lombok.Getter;

@Getter
public enum MenuTypeEnum {

    FOLDER(1, "文件夹"),
    OPTION(2, "选项");

    private Integer code;
    private String desc;

    MenuTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String getDesc(Integer code) {
        for (MenuTypeEnum value : MenuTypeEnum.values()) {
            if (value.code.equals(code)) {
                return value.desc;
            }
        }
        return null;
    }

    public static Integer getCode(String desc) {
        for (MenuTypeEnum value : MenuTypeEnum.values()) {
            if (value.desc.equals(desc)) {
                return value.code;
            }
        }
        return null;
    }

}
